<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <ul>
            <li v-for="(item,index) in list">{{ item }} <button @click="del(index)">删除</button></li>
        </ul>
        <button @click="generate">生成</button>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        const app = new Vue({
            el:'#app',
            data: {
                list:['1']
            },
            methods:{
                del(index){
                    this.list.splice(index,1)
                },
                generate(){
                    this.list.push((Math.random() * 21).toFixed(0))
                }
            }
        })
    </script>
</body>
</html>